#ifndef GWCONTROLLER_H
#define GWCONTROLLER_H

#include <QWidget>
#include <QPaintEvent>
#include <QMouseEvent>
#include <QKeyEvent>

class QwController : public QWidget
{
    Q_OBJECT

public:
    QwController();

    void paintEvent( QPaintEvent *event );

signals:
    void newCommand( int cmd_left, int cmd_right );

protected:
    void keyPressEvent( QKeyEvent * event );
    void keyReleaseEvent( QKeyEvent * event );
    void mouseMoveEvent( QMouseEvent * event );
    void mousePressEvent( QMouseEvent * event );
    void mouseReleaseEvent( QMouseEvent * event );

    void doUpdate();
    void calculCommand();

    int joy_x, joy_y;
    int max_x, max_y;
    int m_cmd_left;
    int m_cmd_right;

    int ctrlg, ctrld;
};

#endif // GCONTROLLER_H
